<!DOCTYPE html>
<html>
{include file="Login/header" /}
<style>
    img{width: 200px}
    span{color: #cc181b}
</style>
<body class="login" mycollectionplug="bind" style="background: #44AAFF">
<div class="login_out"><a href="{:url('index/login')}">切换其他账号登录</a> </div>
<div class="reg_boder reg_boder_height_320">
    <div class="reg_m" >
        <div class="reg_title">
            <div style="font-size: 26px;    ">个人商户实名认证</div>
        </div>
        <br/>
        <br/>
        <form action="{:url('Login/real_personal')}" id="regFrom" method="post">
            <h2><span>*</span>姓名：</h2>
            <label>
                <input type="email" name="realname" class="txt_input txt_input2" required  value="" placeholder="">
            </label>
            <h2><span>*</span>身份证号码：</h2>
            <label>
                <input type="text" name="idcard" class="txt_input txt_input2" required  value="" placeholder="">
            </label>
            <label>
                <div class="col-sm-12 text-center" style="width: 300px;margin: 0 auto;">
                    <button type="button" id="submit" class="btn btn-success">提交</button>
                </div>
            </label>
        </form>
    </div>
</div>

</body>
{include file="Login/footer" /}
<script>

    $(document).ready(function(){
        $("#submit").click(function(){

            var card = jQuery("input[name='idcard']");
            if(card.val()==''){
                alert('身份证号码不得为空');return;
            }

            var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
            if(pattern.test($.trim(card.val())) == false)
            {
                alert('身份证号码不合规');
                $(this).val('');
                $('#identity').focus();
                return;
            }




            var data = $("#regFrom").serialize();
            toAjax("{:url('User/real_personal')}",
                data,"POST",
                function(rs){
                    console.log(rs);

                    if(rs.code == 1){
                        console.log(rs.message);
                        if(rs.data.url != null){
                            window.location = rs.data.url;
                        }
                        else{
                            alert(rs.message);
                        }
                    }

                    if(rs.code == 0){
                        window.location = rs.data.url;
                    }
                },
                false,false,this);

        });

    });


</script>
